package com.woniuxy.controller;

import com.woniuxy.client.OrderServiceFeignClient;
import com.woniuxy.entity.Appointments;
import com.woniuxy.entity.Department;
import com.woniuxy.entity.Doctor;
import com.woniuxy.service.AppointmentService;
import com.woniuxy.utils.ResponseResult;
import com.woniuxy.vo.AppointmentsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/medical")
public class AppointmentController {

    @Autowired
    AppointmentService appointmentservice;
    @PostMapping("/buildAppointment")  // medical/buildAppointment
    public ResponseResult<Object> buildAppointment(@RequestBody AppointmentsVo appointments){
        Object info =  appointmentservice.buildAppointment(appointments);
        System.out.println("controller层检查"+info);
        return ResponseResult.success(info);
    }

    @GetMapping("/selectAppByOrCond")  // medical/selectAppByOrCond
    public ResponseResult<List<AppointmentsVo>> selectAppByOrCond(@RequestParam("userId") Integer userId
            ,@RequestParam("status") Integer status,@RequestParam("pay_type") Integer pay_type ){

        List<AppointmentsVo>  AppointmentsVos=appointmentservice.selectAppByOrCond(userId,status,pay_type);
        return ResponseResult.success(AppointmentsVos);
    }
    @GetMapping("/selectAppByOrCond1")  // medical/selectAppByOrCond
    public ResponseResult<List<AppointmentsVo>> selectAppByOrCond1(@RequestParam("userId") Long userId
            ,@RequestParam("status") Integer status,@RequestParam("pay_type") String pay_type ){
        List<AppointmentsVo>  AppointmentsVos=appointmentservice.findAppointmentsByConditions(pay_type,status,userId);
        return ResponseResult.success(AppointmentsVos);
    }



}
